home *** CD-ROM | disk | FTP | other *** search
/ Aminet 39 / Aminet 39 (2000)(Schatztruhe)[!][Oct 2000].iso / Aminet / util / wb / DirScanner.lha / DirScanner / Rexx / Favourites.dsrx < prev    next >
Encoding:
Text File  |  2000-06-02  |  3.6 KB  |  147 lines

  1. /*
  2. **  $VER: Favourites.dsrx 0.002 (01 Jun 2000)
  3. **
  4. **        © 2000 Andreas Mixich
  5. **
  6. **  PROGRAMNAME:
  7. **      Favourites.dsrx
  8. **
  9. **  FUNCTION:
  10. **      Macro for DirScanner. Reads in a list of specified paths.
  11. **      Set up as menu entry ! You can have different presets.
  12. **       Documents  -  Favourites.dsrx docs.lst
  13. **       Archives   -  Favourites.dsrx archives.lst
  14. **       and so on....
  15. **      Argument APPEND/S adds the new list to existing one without
  16. **       clearing paths list before
  17. **
  18. **  INSTALLATION:
  19. **      Modify the variable within this script:
  20. **      "defaultconfigpath" at line 68
  21. **
  22. **      Set up as ARexx-menu-entry in DirScanner Prefs.
  23. **      Example:
  24. **
  25. **      Name                Path
  26. **      Find Archives       rexx/favourites.dsrx arcs.lst
  27. **      Find Downloads      rexx/favourites.dsrx downloads.lst
  28. **      Add Archives        rexx/favourites.dsrx arcs.lst APPEND
  29. **      Add Downloads       rexx/favourites.dsrx downloads.lst APPEND
  30. **
  31. **     The list, containing the paths must be like this:
  32. **      path1
  33. **      path2/directory/
  34. **      path3/directory
  35. **     No empty lines or multiple paths on one line are allowed.
  36. **
  37. **  TODO/BUGS: Find a way to trap RC > 0 It should work. Why does it not ?
  38. **
  39. **
  40. **  $HISTORY:
  41. **
  42. **   01 Jun 2000 : 0.02 : added APPEND/S
  43. **   01 Jun 2000 : 0.01 : initial release
  44. */
  45.  
  46.  
  47. /* ///------------------- "Init,ReadArgs,Setvars,AddLibs" -------------------- */
  48.  
  49. /* enable support functions */
  50. OPTIONS RESULTS
  51. OPTIONS FAILAT 100
  52.  
  53. SIGNAL ON ERROR
  54. SIGNAL ON FAILURE
  55. SIGNAL ON HALT
  56. SIGNAL ON BREAK_C
  57. SIGNAL ON SYNTAX
  58.  
  59. /* define some usefull vars */
  60. TRUE        = 1
  61. FALSE       = 0
  62. LF          = '*n'                      /* linefeed         */
  63. appname     = 'Favourites.dsrx'         /* program's name   */
  64. appversion  = '$VER: Favourites.dsrx 0.001 (01 Jun 2000) Andreas Mixich <sp.amix@gmx.net>'
  65. appauthor   = 'Andreas Mixich <sp.amix@gmx.net>'
  66. appcopyr    = '© 2000 Andreas Mixich <sp.amix@gmx.net>'
  67. ArgsTemplate = "CONFIG/A,APPEND/S,PORTNAME/A"
  68. defconfigpath = "sys:tools/hdtools/dirscanner/rexx/lists/"       /* modify to suite your needs */
  69.  
  70. /* add the needed libraries */
  71. IF ~SHOW('LIBRARIES','rexxdossupport.library') THEN
  72.     CALL ADDLIB('rexxdossupport.library',0,-30,0)
  73. IF ~SHOW('LIBRARIES','rexxsupport.library') THEN
  74.     CALL ADDLIB('rexxsupport.library',0,-30,0)
  75.  
  76.  
  77. PARSE ARG argu
  78. IF ~ReadArgs(argu,ArgsTemplate,'argu.') THEN
  79.     DO
  80.     Call WriteLN(STDOUT,Fault(RC)||' '||appname)
  81.     EXIT(10)
  82.     END
  83.  
  84. IF PathPart(argu.CONFIG) = "" THEN
  85.     argu.CONFIG = AddPart(defconfigpath,argu.CONFIG)
  86.  
  87. /*\\\*/
  88. /* ///-------------------------------- "Main" -------------------------------- */
  89.  
  90. IF argu.PORTNAME = "" THEN argu.PORTNAME = "DIRSCANNER.1"
  91. address value argu.PORTNAME
  92.  
  93. IF argu.APPEND ~= TRUE  THEN
  94.     'CLEARPATHS'
  95.  
  96. IF ~Open(c,argu.CONFIG,R) THEN
  97.     DO
  98.         'REQUESTER "'||appname||LF||'Can not find list file\033nExiting"'
  99.         EXIT
  100.     END
  101. ELSE
  102.     DO UNTIL EOF(c)
  103.         line = ReadLN(c)
  104.         IF line = "" THEN
  105.             LEAVE
  106.         'ADDPATH '||line
  107.         IF RC=20 THEN
  108.             'REQUESTER "Path '||line||' does not exist"'
  109.     END
  110. EXIT
  111.  
  112.  
  113. /*\\\*/
  114. /* ///------------------------------- "Errors" ------------------------------- */
  115.  
  116.  
  117. /* BREAK_C */
  118. BREAK_C:
  119.  
  120.   txt = appname||' : ***BREAK'
  121.   'REQUESTER "'||txt||'"'
  122.   EXIT
  123. RETURN
  124.  
  125. /* ARexx HALT */
  126. HALT:
  127.  
  128.   txt = appname||' : HALTED'
  129.   'REQUESTER "'||txt||'"'
  130.   EXIT
  131. RETURN
  132.  
  133. /* Error */
  134. ERROR:
  135. SYNTAX:
  136. FAILURE:
  137.  
  138.   txt1 = appname||' : Error at line '||SIGL||':  '||SourceLine(SIGL)
  139.   txt2 = 'Error: '||RC||'  '||ErrorText(RC)
  140.   txt = txt1||LF||txt2
  141.   'REQUESTER "'||txt||'"'
  142.  EXIT
  143. RETURN
  144.  
  145. /*\\\*/
  146.  
  147.